


<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://displaytag.sf.net/el" prefix="display"%>
<%@ taglib uri="/WEB-INF/config/tld/fmt.tld" prefix="fmt" %>
<%@ taglib uri="http://ssh.org/selects" prefix="ssh"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
String applicationPath = basePath + "/" + "application";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>待选择项目列表</title>
<link href="<%=path%>/css/jinmu_style.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="<%=path%>/js/util.js"></script>
<base   target="_self">
</head>
<body >

<html:form styleId="projectworksheetsForm" action="popuPropectSelect.do?method=popuPropectSelect">
      <input type="hidden" id="totalPage" value="${totalPage}"/>
     <table cellspacing="0" cellpadding="0" width="98%" align="center"  border="0" class="margtb5">
	    <tr>
	      <td align="left" class="padl5 lan12"><img src="<%=path%>/images/img-11.gif" width="12" height="12">&nbsp;待选择项目列表&nbsp;</td>
	    </tr>
	 </table>

 <table cellspacing="3" cellpadding="0" width="98%" align="center"  border="0" class="kuang2 margtb5 hei12">
		<tr>
		     <td width="6%" align="right"><bean:message key="com.application.projectworksheets.entity.projectworksheets.listpage.year" bundle="projectworksheets"/>：</td>
	           <td width="10%">
		     
		    		
		      		     <ssh:select propertyName="year" dataSource="collection" selectList="${yearSelect}"  type="1" defaultName="${projectworksheetsForm.year}"/>
		                         		   		   </td>
                   		   <td width="10%" align="right"><bean:message key="com.application.projectworksheets.entity.projectworksheets.listpage.projectid" bundle="projectworksheets"/>：</td>
	           <td width="15%">
		     
		    		   
		      		      <html:text property="projectid"/>
		                         		   		   </td>
                   		   <td width="6%" align="right"><bean:message key="com.application.projectworksheets.entity.projectworksheets.listpage.projectname" bundle="projectworksheets"/>：</td>
	           <td width="15%">
		     
		    		   
		      		      <html:text property="projectname"/>
		                         		   		   </td>
                   		  <td width="22%"><input class="buttonbg" id="but_query" type="button" value="<bean:message key='com.syc.common.projectworksheets.query'  bundle="projectworksheets"/>" name="but_query" onClick="query();" /></td>
		</tr>
	</table>
	




				
	<table cellspacing="0" cellpadding="0" width="98%" align="center"  border="0" class="margb5">
	<!--  
      <tr>
        <td colspan="8" class="bgcolor2 padlr5">
          <table border="0" cellspacing="0" cellpadding="0" class="lan13b">
	    <tr>
		  <td width="3%" align="center"><img src="<%=applicationPath%>/images/tianjia.gif" alt="<bean:message key='com.syc.common.projectworksheets.choose'  bundle="projectworksheets"/>" height="15" width="15" /></td>
		  <td class="lieb-zi"  align="left" width="97%"><a href="#" onClick="choose();" ><bean:message key='com.syc.common.projectworksheets.choose'  bundle="projectworksheets"/></a></td>
	   </tr>
	</table> 
   </td>
 </tr>
 -->
			<tr>
				<td>			
		<fmt:bundle basename="com.application.projectworksheets.struts.ApplicationResources_projectworksheets">
		<display:table name="projectworksheetsList" class="simple" id="a_projectworksheets"  partialList="true" defaultsort="1" defaultorder="descending" size="resultSize" requestURI="popuPropectSelect.do?method=popuPropectSelect"  > 			       
			<display:column style="width:5%; text-align:center;" title="<input type='checkbox' id='checkall' onclick='checkAll();'/> 全选" >
			    <input type="checkbox" name="id"  headerClass="sortable" value="${a_projectworksheets.id}"
			    onclick="selectProject('${a_projectworksheets.id}','${a_projectworksheets.projectid}','${a_projectworksheets.projectname}','${a_projectworksheets.ifoutsourcing}')"/>
			</display:column>
																																																																																																																																																																																																																																													
									 
          <display:column property="projectname" titleKey="com.application.projectworksheets.entity.projectworksheets.listpage.projectname" sortable="true" style="width:25%;text-align:center;"/>
			                          												 
        <display:column property="projectid" titleKey="com.application.projectworksheets.entity.projectworksheets.listpage.projectid" sortable="true" style="width:5%;text-align:center;"/>
			                          												      												 
        <display:column property="principal" titleKey="com.application.projectworksheets.entity.projectworksheets.listpage.authority" sortable="true" style="width:5%;text-align:center;"/>
         <display:column property="year" titleKey="com.application.projectworksheets.entity.projectworksheets.listpage.year" sortable="true" style="width:5%;text-align:center;"/>
			                          							       </display:table>
	       </fmt:bundle>
				</td>
			</tr>
		</table>
		<br><br><br><br>
		
		
		
		 <table width="100%" border="0" cellspacing="0" cellpadding="0">
				  <tr>
				    <td align="center">
				    <input class="buttonbg" id="but_return" type="button" value="确定" name="q_return" onClick="choose();"/>
				     <input class="buttonbg" id="but_return" type="button" value="<bean:message key='com.syc.common.projectworksheets.close'  bundle="projectworksheets"/>" name="but_return"" onClick="javascript:window.close();"/>
				  </tr>
				</table>

     </html:form>
	</body>
</html>
<script>

function query(){
	document.forms[0].action="popuPropectSelect.do?method=popuPropectSelect";
	document.forms[0].submit();
}

	
	
function validateSelect(){ 
    var count = 0;
    var jysBox = $s("id");
    for(var i=0;i<jysBox.length;i++){
		if(jysBox[i].checked){
        	count++;
		}
	}
    return count;
}

//查看
function view(){
	var result = validateSelect();
	if(result==0){
		alert("请选择一条记录！");
		return;
	}else if(result>1){
	    alert("一次只能查看一条记录！");
		return;
	}else{
		document.forms[0].action="viewProjectworksheets.do?method=viewProjectworksheets";
	    document.forms[0].submit();
	}
}


//全选   
function checkAll()   
{ 
  
   var chk=document.getElementsByName("id");   
   for(var i=0;i<chk.length;i++)   
   { 
     if($('checkall').checked){
     	chk(i).checked=true; 
     	chk(i).onclick();
     }else{
        chk(i).checked=false; 
     } 
       
 }
}   
var projectMap = new Map();
this.returnValue = new Array();
var idArray = new Array();
var split = "^";
function selectProject(id,projectid,projectname,isout){    
    if(isout=='1'){
       isout = '合作研发';
    }else{
       isout = '自主研发';
    }
    var resultValue = id + split +  projectid + split + projectname  + split + isout;
	projectMap.put(id,resultValue);
}
function choose(){
   var chk=document.getElementsByName("id");   
   for(var i=0;i<chk.length;i++)   
   { 
     var projectid = chk(i).value;
     if(!chk(i).checked){
     	
     	if(projectMap.containsKey(projectid)){
     		projectMap.remove(projectid);
     	}
     }else{
        idArray.push(projectid);
        var key = projectid;
        var stvalue = projectMap.get(key);
        this.returnValue[key]= stvalue;
     }
   }
   this.returnValue["ids"] = idArray.toString();
   window.close();
}
</script>
